const http2 = require('http2');
// https就可以访问http2
const server = http2.createSecureServer({
    key: fs.readFileSync('server.pem'),
    cert: fs.readFileSync('server.pem'),
})
// http2使用流式传输
server.on('stream', (stream, headers) => {
    stream.respond({
        'content-type': 'text/html',
        ':status': 200
    })
    stream.end('<h1>你好</h1>')
})
server.listen(9999, () => {
    console.log('listen 9999')
})